<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
Sample Form
<form th:action="@{form}" method="post" th:object="${user}">
<label>姓名：</label><input id="name" type="text" th:field="${user.name}" th:errorclass="invaild"><br/>
<div th:errors="*{name}">Error</div>
<label>年龄：</label><input id="age" type="number" th:field="${user.age}"><br/>
<label>身高：</label><input id="height" type="number" th:field="${user.height}"><br/>
<label>生日：</label><input id="birthDate" type="text" th:field="${user.birthDate}" th:errorclass="invalid"><br/>
<div th:errors="*{birthDate}">BirthDate Error</div>
<input type="submit" value="SUBMIT">
<ul th:if="${#fields.hasErrors('*')}" class="errorlist">
<li th:each="err : ${#fields.errors('*')}" th:text="${err}">Input
is incorrect</li>
</ul>
</form>

</body>
</html>